package cn.itsource.org.mapper;

import cn.itsource.org.domain.Department;
import cn.itsource.org.query.DepartmentQuery;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

public interface DepartmentMapper extends Mapper<Department> {
    //分页方法
    List<Department> findPage(DepartmentQuery query);

    //查询上级部门
    List<Department> findParentDepts();

    //java新特性，这么接口可以有方法体了
    default List<Department> likeByDirPath(String oldDirPath){
        //拼接like条件
        Example example = new Example(Department.class);
        example.and().andLike("dirPath","%"+oldDirPath+"%");
        //执行查询
        return this.selectByExample(example);
    }

    //要使用自己自定义的变量名，必须要注解@Param("ids")
    //void batchDelete(@Param("ids") Long[] ids);

    //基础的crud通过继承得到



}
